<!doctype html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>服刑信息查看</title>
    <script src="/webjars/miniui/boot.js" type="text/javascript"></script>
    <link href="/static/css/resource.css" rel="stylesheet" type="text/css" />
    <script src="/static/js/common/common.js" type="text/javascript"></script>
    <link href="/webjars/miniui/css/demo.css" rel="stylesheet" type="text/css" />
    <link href="/static/css/default.css" rel="stylesheet" type="text/css" />
    <style>
        .discell {
            text-align:right;
            width:150px;
        }
        .input {
            width:200px;
        }
    </style>
</head>
<body>

<form id="form1" method="post" style="height:100%;width: 100%;overflow-x: auto;overflow-y: auto;">
    <!-- 用户 编辑框START-->
    <div id="editform" class="form" style="padding:10px;">
        <input name="id" id="id" class="mini-hidden" style="width: 100%;" readonly />
        <input name="orgName" class="mini-hidden" style="width: 100%;" readonly />
        <input name="priNum" id="priNum" class="mini-hidden" style="width: 100%" readonly />
        <table class="form-table" align="center" style="border-collapse:separate; border-spacing:20px;">
            <tr>
                <td class="discell">姓&emsp;&emsp;名:</td>
                <td class="input">
                    <input name="pName" id="pName" textField="pName" valueField="pName" class="mini-textbox" readonly="readonly"
                           style="width: 300px;" />
                </td>
                <td class="discell">证件号:</td>
                <td>
                    <input name="idNum" id="idNum" textField="idNum" valueField="idNum" class="mini-textbox" readonly="readonly"
                           style="width: 300px;" />
                </td>
            </tr>
            <tr>
                <td class="discell"><font color="#dc143c">*</font>罪&emsp;&emsp;&emsp;名:</td>
                <td class="input">
                    <input class="mini-textarea" name="critype" id="critype" style="width: 300px;height:100px;"
                           textField="codeName" valueField="codeId" emptyText="请选择..." popupHeight="50px"
                           required="true" readonly="readonly" />
                </td>
                <td class="discell"><font color="#dc143c">*</font>犯&emsp;罪&emsp;类&emsp;型:</td>
                <td class="input">
                    <input class="mini-textarea" name="fzlx" id="fzlx" onclick="itemclick('fzlx')"
                           textField="codeName" valueField="codeId" emptyText="请选择..." style="width: 300px;height:100px;"
                           required="true" allowInput="false" showNullItem="true" readonly="readonly" />
                </td>
            </tr>
            <tr>
                <td class="discell"><font color="#dc143c">*</font>
                    <#if "${localCode !''}"=='140000'>
                        判&nbsp;&nbsp;决&nbsp;&nbsp;刑&nbsp;&nbsp;期:
                    <#else>
                        现&emsp;刑&emsp;期:
                    </#if>
                </td>
                <td class="input">
                    <input name="pritime" id="pritime" class="mini-combobox" required="true" onclick="itemclick('xxq')"
                           textField="codeName" valueField="codeId" emptyText="请选择..." onvaluechanged="valuechanged()"
                           required="true" readonly="readonly" allowInput="false" style="width: 300px;" />
                </td>
                <td class="discell"><font color="#dc143c">*</font>附&emsp;加&emsp;刑:</td>
                <td class="input">
                    <input name="addpenalty" id="addpenalty" class="mini-combobox" required="true"
                           onclick="itemclick('fjx')"
                           textField="codeName" valueField="codeId" emptyText="请选择..." multiSelect="true"
                           required="true" allowInput="false" style="width: 300px;" readonly="readonly"/>
                </td>
            </tr>
            <tr>
                <td class="discell"><font color="#dc143c">*</font>
                    <#if "${localCode !''}"=='140000'>
                        原判刑期始日期:
                    <#else>
                        原判刑期起日:
                    </#if>
                    </td>
                <td class="input">
                    <input property="editor" class="mini-datepicker" id="priBegin" name="priBegin" required="true"
                           style="width: 300px;"
                           readonly="readonly"/>
                </td>
                <td class="discell"><font color="#dc143c">*</font>
                    <#if "${localCode !''}"=='140000'>
                        原判刑期止日期:
                    <#else>
                        原判&nbsp;&nbsp;刑期&nbsp;&nbsp;止日:
                    </#if>
                    </td>
                <td class="input">
                    <input property="editor" class="mini-datepicker" id="priStop" name="priStop" required="true"
                           style="width: 300px;"
                           readonly="readonly" disabled="disabled"/>
                </td>
            </tr>
            <tr>
                <td class="discell"><font color="#dc143c">*</font>案&emsp;犯&emsp;类&emsp;别:</td>
                <td class="input">
                    <input name="aftype" id="aftype" class="mini-combobox" required="true" onclick="itemclick('aflb')"
                           textField="codeName" valueField="codeId" emptyText="请选择..."
                           required="true" allowInput="false" style="width: 300px;" readonly="readonly"/>
                </td>
                <td class="discell"><font color="#dc143c">*</font>逮&emsp;捕&emsp;机&emsp;关:</td>
                <td class="input">
                    <input name="arrJg" id="arrJg" class="mini-textbox" required="true" style="width: 300px;"
                           readonly="readonly"/>
                </td>
            </tr>
            <tr>
                <td class="discell"><font color="#dc143c">*</font>是否累惯犯:</td>
                <td class="input">
                    <input name="precri" id="precri" class="mini-radiobuttonlist"
                           data="[{ id: 1, name: '是' },{ id: 2, name: '否' }]" readonly="readonly"
                           textField="name" valueField="id" value="2" required="true" style="width: 300px;"/>
                </td>

                <td class="discell"><font color="#dc143c">*</font>是否疾病、残疾:</td>
                <td class="input">
                    <input name="canji" id="canji" class="mini-radiobuttonlist"
                           data="[{ id: 1, name: '是' },{ id: 2, name: '否' }]"
                           textField="name" valueField="id" required="true" style="width: 300px;" readonly/>
                </td>
            </tr>
            <tr>
                <td class="discell"><font color="#dc143c">*</font>捕&nbsp;前&nbsp;职&nbsp;业:</td>
                <td class="input">
                    <input class="mini-combobox" name="bqzy" id="bqzy" style="width: 300px;"
                           textField="codeName" valueField="codeId" emptyText="请选择..." popupHeight="55px"
                           required="true" readonly="readonly" />
                </td>
                <td class="discell">捕前&nbsp;&nbsp;职业&nbsp;&nbsp;分类:</td>
                <td class="input">
                    <input class="mini-combobox" name="jinengtype" id="jinengtype" onclick="itemclick('zyjn')"
                           textField="codeName" valueField="codeId" emptyText="请选择..." style="width: 300px;"
                           allowInput="false" showNullItem="true" readonly="readonly" />
                </td>
            </tr>
        </table>
    </div>
</form>
<script type="text/javascript">
    mini.parse();
    var form = new mini.Form("form1");
    var priNum = mini.get("priNum");
    var id = mini.get("id");
    var critype = mini.get("critype");
    var bqzy = mini.get("bqzy");
    var fzlx = mini.get("fzlx");
    var jinengtype = mini.get("jinengtype");
    var aftype = mini.get("aftype");
    var addpenalty = mini.get("addpenalty");
    var pritime = mini.get("pritime");
    var pName = mini.get("pName");
    var idNum = mini.get("idNum");

    window.onload = function (ev) {
        priNum.setValue(${prinum!''});
        SetData(priNum.getValue());
    }

    //标准方法接口定义
    function SetData(data) {
        form.setEnabled(false);
        if (data) {
            mini.get("id").setEnabled(false);
        }
        // 根据ID去数据库中查询数据
        $.ajax({
            url: "/azbj/inmates/getseninfo?prinum=" + data,
            type: "post",
            dataType: "json",
            success: function (sendata) {
                    var bf = mini.decode(sendata);
                    form.setData(sendata);
                    form.setChanged(false);
                    mini.get("critype").setValue(bf.critype);
                    mini.get("critype").setText(bf.critypename);
                    codeIds = bf.critype;
                    mini.get("fzlx").setValue(bf.fzlx);
                    mini.get("fzlx").setText(bf.fzlxname);
                    jinengtype.setData([{codeId: bf.jinengtype, codeName: bf.jinengtypeName}]);
                    pritime.setData([{codeId: bf.pritime, codeName: bf.pritimeName}]);
                    addpenalty.setData([{codeId: bf.addpenalty, codeName: bf.addpenaltyName}]);
                    mini.get("addpenalty").setValue(bf.addpenalty);
                    mini.get("addpenalty").setText(bf.addpenaltyName);
                    aftype.setData([{codeId: bf.aftype, codeName: bf.aftypeName}]);
                    bqzy.setData([{codeId: bf.bqzy, codeName: bf.bqzyName}]);
                    var priStop = mini.get("priStop");
                    if (pritime.getValue() == "9995" || pritime.getValue() == "9996" || pritime.getValue() == "9997") {
                        priStop.disable();
                        priStop.setValue("");
                    } else {
                        priStop.setReadOnly(true);
                    }
                    pName.setValue("${pname!''}");
                    idNum.setValue("${idnum!''}");
                    valuechanged();
            }
        });
    }

    function valuechanged(e) {
        var pritime = mini.get("pritime");
        var pritimeval = pritime.getValue();
        var priStop = mini.get("priStop");
        if (pritimeval == "01" || pritimeval == "02") {
            priStop.disable();
            priStop.setValue("");
        }
    }
</script>
</body>
</html>